package com.example.myproject.repository;

import com.example.myproject.model.BountySubmission;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface BountySubmissionRepository extends JpaRepository<BountySubmission, Long> {

    // 根据悬赏ID查询提交记录
    List<BountySubmission> findAllByBountyId(Long bountyId);

    // 根据响应人ID查询提交记录
    List<BountySubmission> findAllByResponserId(Long responserId);

    // 根据悬赏和响应人查询（如用于校验是否已提交过）
    BountySubmission findByBountyIdAndResponserId(Long bountyId, Long responserId);

    Optional<BountySubmission> findByBountyId(Long bountyId);

    List<BountySubmission> findAllBySubmissionStatus(BountySubmission.SubmissionStatus status);

}
